package GUI.ClientConnection;



import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JScrollPane;

import java.awt.Font;
import java.awt.Frame;

import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JTextArea;

import java.awt.Color;
import java.io.IOException;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import javax.swing.JPasswordField;
import javax.swing.border.MatteBorder;


public class ClientConnectToServerGui extends Frame {
	public JPanel mainPan;
	public JButton btnConnect; 
	String hostIp;
	String realPort;
	public  JTextField textServerAdd;
	public JTextField textPort;
	public JTextArea textArea;
	//public JTextArea fromserver;
	
	public ClientConnectToServerGui() {
		mainPan= new JPanel();
		mainPan.setSize(518,410);
		mainPan.setLayout(null);
		
		textServerAdd = new JTextField();
		textServerAdd.setText("127.0.0.1");
		textServerAdd.setBounds(196, 58, 86, 20);
		mainPan.add(textServerAdd);
		textServerAdd.setColumns(10);
		
		JLabel lblServerIp = new JLabel("Ip");
		lblServerIp.setBounds(10, 61, 46, 14);
		mainPan.add(lblServerIp);
		
		JLabel lblPort = new JLabel("Port");
		lblPort.setBounds(10, 108, 46, 14);
		mainPan.add(lblPort);
		
		btnConnect = new JButton("Connect");
		btnConnect.setBounds(196, 156, 89, 23);
		mainPan.add(btnConnect);
		
		textPort = new JTextField();
		textPort.setText("1234");
		textPort.setBounds(196, 105, 86, 20);
		mainPan.add(textPort);
		textPort.setColumns(10);
		
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setViewportBorder(new MatteBorder(1, 1, 1, 1, (Color) Color.WHITE));
		scrollPane.setBounds(22, 186, 274, 81);
		mainPan.add(scrollPane);
		
		textArea = new JTextArea();
		scrollPane.setViewportView(textArea);
		textArea.setEditable(false);
		
		/*fromserver = new JTextArea();
		fromserver.setFont(new Font("Arial", Font.BOLD, 11));
		fromserver.setForeground(Color.BLACK);
		fromserver.setBackground(Color.WHITE);
		fromserver.setBounds(32, 288, 316, 67);
		fromserver.setEditable(false);
		mainPan.add(fromserver);*/
	}
	
	
	
	public void displayFromServer(String s)
	{
		textArea.append(s + " ");
	}



	public void setVisible(boolean b) {
		this.setVisible(true);
		
	}
}
	
